package com.xiaohui.user.designPattern.strategy;

public enum PayChannelEnum {
    ALIPAY(0, "支付宝"),
    WECHAT(1, "微信"),
    BANK(2, "银行卡");

    private Integer code;
    private String desc;

    private PayChannelEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PayChannelEnum getByCode(Integer code) {
        for (PayChannelEnum payChannelEnum : PayChannelEnum.values()) {
            if (payChannelEnum.code == code) {
                return payChannelEnum;
            }
        }
        return null;
    }
}
